//
//  ScanViewController.swift
//  testRxSwift
//
//  Created by 火星人 on 2017/7/25.
//  Copyright © 2017年 火星人. All rights reserved.
//

import UIKit
import RxSwift

class ScanViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.addTapWithHandle { (tap) in
            
            let dbag = DisposeBag()
            
            Observable.of(12, 21, 32, 43)
                .scan(100, accumulator: { (aggregateValue, value) -> Int in
                    print(aggregateValue)
                    return value + aggregateValue
                })
                .subscribe({ (eve) in
                    print(eve)
                })
                .disposed(by: dbag)
        }
    }
}
